#include <bits/stdc++.h>
// 2025/03/03
// tag: 
// Author: Forever
using namespace std;

using int64 = int64_t;

int n, k, ans[100001];

void solve(){
    int cnt = 1;
    for (int i = k; i <= n; i += k, cnt++)
        ans[i] = cnt;
    for (int i = 1; i <= n; i++)
        if (i % k != 0)
            ans[i] = cnt++;
    for (int i = 1; i <= n; i++)
        cout << ans[i] << " \n"[i == n];
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--){
        cin >> n >> k;
        solve();
    }
    return 0;
}